<#import "body.ftl" as com>
<@com.body title='友情链接管理 - Miniblog4j' link='active'>
<div class="in">
	<div>
		<form name="linkForm" method="post" action="/admin/link" onsubmit="checkLink()">
			<input type="hidden" name="id" value="${link.id}">
			<input type="hidden" name="oper" value="save">
			<div style="float: left;">
				<p>
					<label class="comment">// 链接名称</label><br>
					<input type="text" name="name" class="box2" placeholder="链接名称" value="${link.name}">
				</p>
				
				<p>
					<label class="comment">// 链接地址</label><br>
					<input type="text" name="url" class="box2" placeholder="链接URL" value="${link.url}">
				</p>
				
				<p>
					<label class="comment">// 链接描述</label><br>
					<input type="text" name="description" class="box2" placeholder="链接描述" value="${link.description}">
				</p>
			</div>
			
			<div style="float: left; margin-left: 60px;">
				<p>
					<label class="comment">// 打开目标</label><br>
					<select name="target" class="box3">
						<option value="_blank">新窗口打开</option>
						<option value="" <#if (''==link.target)>selected</#if>>本窗口打开</option>
				  	</select>
			   </p>
			   <p>
				  	<label class="comment">// 可见性</label><br>
				  	<select name="status" class="box3">
						<option value="visible">可见</option>
						<option value="hidden" <#if ('hidden'==link.status)>selected</#if>>私有</option>
				  	</select>
				</p>
				<p>
					<label class="comment">&nbsp</label><br>
					<input type="submit" class="com_btn" value="保存">
					<input type="button" class="com_btn" value="清空" onclick="clearLink()">
				</p>
			</div>
			
			<div class="clear"></div>
		</form>
	</div>
	
	<#if list?has_content>
		<table border="0" cellspacing="0" cellpadding="10" class="table_main">
		  <tbody><tr style="background-color:#d9d8d8; font-size:14px;">
			<td style="padding: 14px;" width="250"><strong>名称</strong></td>
			<td style="padding: 14px;"><strong>描述</strong></td>
			<td style="padding: 14px;" width="100"><strong>看见性</strong></td>
		  </tr>
		  <#list list as l>
			  <tr class="<#if l_index%2==0>gray</#if>">
				<td>
					<a href="${l.url}" title="${l.description!''}">${l.name}</a>
					<div class="actions_wrapper"><div class="actions" style="display: none;">
						<a href="/admin/link?id=${l.id}">修改</a> |
						<a href="/admin/link?oper=delete&id=${l.id}">删除</a>
					</div></div>
				</td>
				<td>${l.description}</td>
				<td>${status[l.status]}</td>
			  </tr>
		  </#list>
		</tbody></table>
		<p align="right">总数:${list?size}</p>
	<#else>
  		<h2>还没有链接</h2>
	</#if>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
	function checkLink() {
		return true;
	}
	
	function clearLink() {
	}
	
	// 操作
	$("tr").mouseover(function(){
		$(this).find(".actions").show();
	}).mouseout(function(){
		$(this).find(".actions").hide();
	});
</script>
</@com.body>